package com.library.service;

import java.util.List;

import org.apache.commons.codec.digest.DigestUtils;

import com.library.dao.SeatDao;

import com.library.entity.Seat;

import my.db.Page;

public class SeatService {

	private SeatDao dao = new SeatDao();
	//查询得到所有座位总数
	public int Count(long id) {
		return dao.Count(id);
	}
	//查询得到每个校区的座位总数
	public int CampusCoun(String campus) {
		return dao.CampusCount(campus);
	}
	public List<Seat> getSeats(int classroom){
		
		List<Seat> seat=dao.getSeats("classroom", classroom);
		return seat;
	}
	public List<Seat> getByXm(String name) {
		return dao.getSeats("name", name);
	}
	public Page<Seat> list(Page<Seat> page, String campus) {
		return dao.findPage(page, campus);
	}
	/*
	 * 个人预约信息
	 * */
	public Page<Seat> listPerson(Page<Seat> page,String name) {
		return dao.findPagePerson(page,name);
	}

	public void save(Seat seat) {
		dao.save(seat);
	}

	public Seat get(Long id) {
		return dao.get(id);
	}

	public void update(Seat seat) {
		dao.update(seat);
	}
	public void update1(Seat seat) {
		dao.update1(seat);
	}
	public void delete(long id) {
		dao.delete(id);		
	}
//	public static void main(String[] args) {
//		String xx = DigestUtils.md5Hex("123456");
//		System.out.println(xx);
//	}
}
